<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <!--比较经典-->
    <style>
        .bbb {
            color: red;
            font-size: 40px;
        }
    </style>
    <script>

        /*返回一个 html页面元素也可以*/
        var fun=function (){
            return '<div  onclick="changeColor()" id="aaa" >123</div>'
        }

        var s = fun();
        console.log(s)
        document.write(s)


       function changeColor(){
        //    document.getElementById('aaa').style='color: red;font-size: 30px';
           document.getElementById('aaa').className="bbb";
       }
    </script>
</head>
<body>

</body>
</html>